
//
//  selectedCarTypeView.m
//  didihaha
//
//  Created by 赵忠鹏 on 2017/8/23.
//  Copyright © 2017年 zhaozhongpeng. All rights reserved.
//

#import "selectedCarTypeView.h"
#import "Masonry.h"

@implementation selectedCarTypeView

- (instancetype)init{
    if (self = [super init]) {
        [self createUI];
    }
    return self;
}

- (void)createUI{
    
    UIView *bgView = [[UIView alloc] init];
    [self addSubview:bgView];
    
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
    
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 100, 40) byRoundingCorners:UIRectCornerTopRight|UIRectCornerTopLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(20, 20)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.lineWidth = 0.5f;
    maskLayer.fillColor = [UIColor whiteColor].CGColor;
    maskLayer.strokeColor = [UIColor lightGrayColor].CGColor;
    maskLayer.path = maskPath.CGPath;
    bgView.clipsToBounds = YES;
    [bgView.layer addSublayer:maskLayer];
    
    UIView *nowView = [[UIView alloc] init];
    nowView.backgroundColor = [UIColor whiteColor];
    nowView.clipsToBounds = YES;
    nowView.layer.cornerRadius = 17;
    nowView.layer.borderColor = [UIColor colorWithRed:236/255.0 green:236/255.0 blue:236/255.0 alpha:1].CGColor;
    nowView.layer.borderWidth = 0.5;
    [bgView addSubview:nowView];
    
    [nowView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bgView.mas_centerY);
        make.left.equalTo(bgView.mas_left).offset(3);
        make.width.mas_equalTo(55);
        make.height.mas_equalTo(34);
    }];
    
    
    UILabel *nowLabel = [[UILabel alloc] init];
    nowLabel.font = [UIFont systemFontOfSize:12];
    nowLabel.text = @"现在";
    nowLabel.textAlignment = NSTextAlignmentCenter;
    [nowView addSubview:nowLabel];
    [nowLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(nowView);
    }];
    
    
    UILabel *otherTime = [[UILabel alloc] init];
    otherTime.textAlignment = NSTextAlignmentCenter;
    otherTime.textColor = [UIColor colorWithRed:135/225.0 green:135/225.0 blue:135/225.0 alpha:1];
    otherTime.font = [UIFont systemFontOfSize:12];
    otherTime.text = @"预约";
    [bgView addSubview:otherTime];
    
    [otherTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nowView.mas_right);
        make.top.bottom.right.equalTo(bgView);
    }];
    
}



@end
